//
//  WeatherTableViewCellThree.m
//  ToWhere
//
//  Created by dllo on 15/11/15.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "WeatherTableViewCellThree.h"

@implementation WeatherTableViewCellThree
- (void)dealloc
{
    [_cyBtn release];
    [_cyImage release];
    [_cy release];
    [_cyzs release];
    [_gm release];
    [_gmzs release];
    [_gmImage release];
    [_gmBtn release];
    [_hz release];
    [_hzBtn release];
    [_hzImage release];
    [_hzzs release];
    [_yd release];
    [_ydBtn release];
    [_ydImage release];
    [_ydzs release];
    [_ly release];
    [_lyBtn release];
    [_lyImage release];
    [_lyzs release];
    [_zwx release];
    [_zwxBtn release];
    [_zwxImage release];
    [_zwxzs release];
    [_xc release];
    [_xczs release];
    [_xcBtn release];
    [_xcImage release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.cyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.cyBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.cyBtn];
        
        self.gmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.gmBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.gmBtn];
        
        self.hzBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.hzBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.hzBtn];
        
        self.ydBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.ydBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.ydBtn];
        
        self.lyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.lyBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.lyBtn];
        
        self.zwxBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.zwxBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.zwxBtn];
        
        self.xcBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.xcBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        [self.contentView addSubview:self.xcBtn];
        
        self.tyjBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.tyjBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
        
        [self.contentView addSubview:self.tyjBtn];
        
        self.cyImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_chuanyi"]];
        [self.contentView addSubview:_cyImage];
        [_cyImage release];
        
        self.gmImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_ganmao"]];
        [self.contentView addSubview:_gmImage];
        [_gmImage release];
        
        self.hzImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_huazhuang"]];
        [self.contentView addSubview:_hzImage];
        [_hzImage release];
        
        self.ydImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_yundong"]];
        [self.contentView addSubview:_ydImage];
        [_ydImage release];
        
        self.lyImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_lvxing"]];
        [self.contentView addSubview:_lyImage];
        [_lyImage release];
        
        self.zwxImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_ziwaixian"]];
        [self.contentView addSubview:_zwxImage];
        [_zwxImage release];
        
        self.xcImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_xiche"]];
        [self.contentView addSubview:_xcImage];
        [_xcImage release];
        
        self.tyjImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"weather_taiyangjing"]];
        [self.contentView addSubview:_tyjImage];
        [_tyjImage release];
        
        self.cyzs = [[UILabel alloc] init];
        self.cyzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.cyzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.cyzs.text = @"穿衣指数";
        [self.contentView addSubview:_cyzs];
        [_cyzs release];
        
        self.gmzs = [[UILabel alloc] init];
        self.gmzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.gmzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.gmzs.text = @"感冒指数";
        [self.contentView addSubview:_gmzs];
        [_gmzs release];
        
        self.hzzs = [[UILabel alloc] init];
        self.hzzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.hzzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.4];
        self.hzzs.text = @"化妆指数";
        [self.contentView addSubview:_hzzs];
        [_hzzs release];
        
        self.ydzs = [[UILabel alloc] init];
        self.ydzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.ydzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.ydzs.text = @"运动指数";
        [self.contentView addSubview:_ydzs];
        [_ydzs release];
        
        self.lyzs = [[UILabel alloc] init];
        self.lyzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.lyzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.lyzs.text = @"旅游指数";
        [self.contentView addSubview:_lyzs];
        [_lyzs release];
        
        self.zwxzs = [[UILabel alloc] init];
        self.zwxzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.zwxzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.zwxzs.text = @"紫外线指数";
        [self.contentView addSubview:_zwxzs];
        [_zwxzs release];
        
        self.xczs = [[UILabel alloc] init];
        self.xczs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.xczs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.xczs.text = @"洗车指数";
        [self.contentView addSubview:_xczs];
        [_xczs release];
        
        self.tyjzs = [[UILabel alloc] init];
        self.tyjzs.font = [UIFont systemFontOfSize:15 *kWidth];
        self.tyjzs.textColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
        self.tyjzs.text = @"太阳镜指数";
        [self.contentView addSubview:_tyjzs];
        [_tyjzs release];
        
        self.cy = [[UILabel alloc] init];
        self.cy.font = [UIFont systemFontOfSize:17 *kWidth];
        self.cy.textColor = [UIColor greenColor];
        [self.contentView addSubview:_cy];
        [_cy release];
        
        self.gm = [[UILabel alloc] init];
        self.gm.font = [UIFont systemFontOfSize:17 *kWidth];
        self.gm.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_gm];
        [_gm release];
        
        self.hz = [[UILabel alloc] init];
        self.hz.font = [UIFont systemFontOfSize:17 *kWidth];
        self.hz.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_hz];
        [_hz release];
        
        self.yd = [[UILabel alloc] init];
        self.yd.font = [UIFont systemFontOfSize:17 *kWidth];
        self.yd.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_yd];
        [_yd release];
        
        self.ly = [[UILabel alloc] init];
        self.ly.font = [UIFont systemFontOfSize:17 *kWidth];
        self.ly.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_ly];
        [_ly release];
        
        self.zwx = [[UILabel alloc] init];
        self.zwx.font = [UIFont systemFontOfSize:17 *kWidth];
        self.zwx.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_zwx];
        [_zwx release];
        
        self.xc = [[UILabel alloc] init];
        self.xc.font = [UIFont systemFontOfSize:17 *kWidth];
        self.xc.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_xc];
        [_xc release];
        
        self.tyj = [[UILabel alloc] init];
        self.tyj.font = [UIFont systemFontOfSize:17 *kWidth];
        self.tyj.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_tyj];
        [_tyj release];
    }
    return self;
}

- (void)layoutSubviews{

    [super layoutSubviews];
    
    self.tyjBtn.frame = CGRectMake(189 *kWidth, 189 *kHeight, 186 *kWidth, 60 *kHeight);
    self.xcBtn.frame = CGRectMake(0, 189 *kHeight, 186 *kWidth, 60 *kHeight);
    self.zwxBtn.frame = CGRectMake(189 *kWidth, 126 *kHeight, 186 *kWidth, 60 *kHeight);
    self.lyBtn.frame = CGRectMake(0, 126 *kHeight, 186 *kWidth, 60 *kHeight);
    self.ydBtn.frame = CGRectMake(189 *kWidth, 63 *kHeight, 186 *kWidth, 60 *kHeight);
    self.hzBtn.frame = CGRectMake(0, 63 *kHeight, 186 *kWidth, 60 *kHeight);
    self.gmBtn.frame = CGRectMake(189 *kWidth, 0, 186 *kWidth, 60 *kHeight);
    self.cyBtn.frame = CGRectMake(0, 0, 186 *kWidth, 60 *kHeight);
    
    self.cyImage.frame = CGRectMake(15 *kWidth, 10  *kHeight, 40 *kWidth, 40 *kHeight);
    self.gmImage.frame = CGRectMake((15 + 189) *kWidth, 10 *kHeight, 40 *kWidth, 40 *kHeight);
    self.hzImage.frame = CGRectMake(15 *kWidth, (10 + 63)*kHeight, 40 *kWidth, 40 *kHeight);
    self.ydImage.frame  = CGRectMake((15 + 189) *kWidth, (10 + 63) *kHeight, 40 *kWidth, 40 *kHeight);
    self.lyImage.frame  = CGRectMake(15 *kWidth, (10 + 63 * 2) *kHeight, 40 *kWidth, 40 *kHeight);
    self.zwxImage.frame = CGRectMake((15 + 189) *kWidth, (10 + 63 * 2) *kHeight, 40 *kWidth, 40 *kHeight);
    self.xcImage.frame =  CGRectMake(15  *kWidth, (10 + 63 * 3) *kHeight, 40 *kWidth, 40 *kHeight);
    self.tyjImage.frame = CGRectMake((15 + 189) *kWidth, (10 + 63 * 3) *kHeight, 40 *kWidth, 40 *kHeight);
    
    self.cyzs.frame = CGRectMake(60 *kWidth, 10 *kHeight, 100 *kWidth, 25 *kHeight);
    self.gmzs.frame = CGRectMake((60 + 189 *kWidth), 10 *kHeight, 100 *kWidth, 25 *kHeight);
    self.hzzs.frame = CGRectMake(60 *kWidth, (10 + 63) *kHeight, 100 *kWidth, 25 *kHeight);
    self.ydzs.frame = CGRectMake((60 + 189 *kWidth), (10 + 63) *kHeight, 100 *kWidth, 25 *kHeight);
    self.lyzs.frame = CGRectMake(60 *kWidth, (10 + 63 * 2) *kHeight, 100 *kWidth, 25 *kHeight);
    self.zwxzs.frame = CGRectMake((60 + 189 *kWidth), (10 + 63 * 2) *kHeight, 100 *kWidth, 25 *kHeight);
    self.xczs.frame = CGRectMake(60 *kWidth, (10 + 63 * 3) *kHeight, 100 *kWidth, 25 *kHeight);
    self.tyjzs.frame = CGRectMake((60 + 189 *kWidth), (10 + 63 * 3) *kHeight, 100 *kWidth, 25 *kHeight);
    
    self.cy.frame = CGRectMake(60 *kWidth, 35 *kHeight, 100 *kWidth, 25 *kHeight);
    self.gm.frame = CGRectMake((60 + 189 *kWidth), 35 *kHeight, 100 *kWidth, 25 *kHeight);
    self.hz.frame = CGRectMake(60 *kWidth, (35 + 63 )  *kHeight, 100 *kWidth, 25 *kHeight);
    self.yd.frame = CGRectMake((60 + 189 *kWidth), (35 +63 ) *kHeight, 100 *kWidth, 25 *kHeight);
    self.ly.frame = CGRectMake(60 *kWidth, (35 +63 * 2)  *kHeight, 100 *kWidth, 25 *kHeight);
    self.zwx.frame = CGRectMake((60 + 189 *kWidth), (35 +63 *2) *kHeight, 100 *kWidth, 25 *kHeight);
    self.xc.frame = CGRectMake(60 *kWidth, (35 +63 * 3)  *kHeight, 100 *kWidth, 25 *kHeight);
    self.tyj.frame = CGRectMake((60 + 189 *kWidth), (35 +63 * 3)  *kHeight, 100 *kWidth, 25 *kHeight);

}
- (void)setDic:(NSDictionary *)dic{

    if (_dic != dic) {
        [_dic release];
        _dic = [dic retain];
    }
    self.cy.text = [dic objectForKey:@"cyint"];
    self.gm.text = [dic objectForKey:@"gmint"];
    self.hz.text = [dic objectForKey:@"hzint"];
    self.yd.text = [dic objectForKey:@"ydint"];
    self.ly.text = [dic objectForKey:@"lyint"];
    self.zwx.text = [dic objectForKey:@"uvint"];
    self.xc.text = [dic objectForKey:@"xcint"];
    self.tyj.text = [dic objectForKey:@"tyjint"];

}
+ (WeatherTableViewCellThree *)weathertableViewCellThreeWithTableView:(UITableView *)tableView{

    static NSString *weathertableViewCellThree = @"weathertableViewCellThree";
    WeatherTableViewCellThree *cell = [tableView dequeueReusableCellWithIdentifier:weathertableViewCellThree];
    if (!cell) {
        cell = [[WeatherTableViewCellThree alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:weathertableViewCellThree];
    }
    return cell;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
